.\"   $Id: gethtitem.3,v 1.1 2002/03/08 13:51:02 fred Exp $
.\" @(#)gethtitem.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun
.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
gethtitem
.XE
.XS4 \n%
.ti 0.2i
gethtitem
.XE4 \}
.TH GETHTITEM 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS"
.SH NAME
gethtitem \- searches an item in a hash table
.so man1/alc_origin.1
.SH SYNOPSIS
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
.nf
#include "mut.h"
int gethtitem(table, key)
ht \(**table;
void \(**key;
.fi
.ft R
.SH PARAMETERS
.TP 20
\fItable\fP
Hash table pointer
.TP 20
\fIkey\fP
Key used by the hash coding function
.SH DESCRIPTION
\fBgethtitem()\fP searches an item in the hash table pointed to by \fItable\fP.
.SH RETURN VALUE
If the key \fIkey\fP exists, the associated value is returned,
if it doesn't, the function returns \fBEMPTYHT\fP.
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
.nf
#include <stdio.h>
#include "mut.h"
check(p)
losig_list *p;
{
char *amatla;
losig_list *ptsig;
locon_list *ptcon;
ht *h;
	for (i = 0, ptsig = p->LOSIG; ptsig; i++, ptsig = ptsig->NEXT);
	h = addht(i);
	/* two connectors can't have the same name! */
	for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT)
		addhtitem(h, ptcon->NAME, 0);
	for (ptsig = p->LOSIG; ptsig; ptsig = ptsig->NEXT) {
		if (ptsig->TYPE == INTERNAL) {
			amatla = getsigname(ptsig);
			/* this is nicely done with sethtitem! */
			if (gethtitem(h, amatla) == EMPTYHT) { 
				printf("N %s;\\n", amatla);
				addhtitem(h, amatla, 0);
			}
		}
	}
	delht();
}
.fi
.ft R
.SH SEE ALSO
.BR mbk (1),
.BR addht (3),
.BR delht (3),
.BR addhtitem (3),
.BR delhtitem (3),
.BR viewht (3).


.so man1/alc_bug_report.1

